package com.loutick.basicforapp.util;

import java.util.Calendar;
import java.util.Random;

import javax.annotation.Resource;

import com.loutick.basicforapp.entity.TVerification;
import com.loutick.basicforapp.service.IVerificationService;

public class VerificationCodeJob {
	@Resource
	private IVerificationService VerificationService;
	
	public void invalidCodeJob(){
//		createTestData();
		invalid();
	}
	
	private void invalid(){
		Calendar c = Calendar.getInstance();
		VerificationService.updateByInvalidCode(c.getTime());
	}
	
	private void createTestData(){
		TVerification record = new  TVerification();
		record.setCodenumber(VerificationCode.createCode(true, 6));
		Calendar c = Calendar.getInstance();
		record.setCreatetime(c.getTime());
//		c.add(Calendar.MINUTE, 10);
		c.add(Calendar.SECOND, 30);
		record.setInvalidtime(c.getTime());
		record.setPhonenumber(VerificationCode.createCode(true, 11));
		VerificationService.insertVerificationCode(record);
	}
	
}
